<template>
  <div>
    <!-- 面包屑导航 S -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/welcome' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 面包屑导航 E -->
    <!-- 主体卡片区域 S -->
    <el-card class="box-card">
      <template>
        <!-- 用户列表 S -->
        <el-table :data="rightsList" border style="width: 100%" stripe>
          <!-- 自增序号列 -->
          <el-table-column type="index" label="#">
          </el-table-column>
          <!-- 权限名称列 -->
          <el-table-column prop="authName" label="权限名称">
          </el-table-column>
          <!-- 路径列 -->
          <el-table-column prop="path" label="路径">
          </el-table-column>
          <!-- 权限等级列 -->
          <el-table-column label="权限等级">
            <template #default="{row}">
              <el-tag :type="row.level === '0' ? '' : row.level === '1' ? 'success' : 'warning'">
                等级{{row.level === '0' ? '一' : row.level === '1' ? '二' : '三'}}
              </el-tag>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </el-card>
    <!-- 主体卡片区域 E -->
  </div>
</template>

<script>
export default {
  data() {
    return {
      rightsList: []
    }
  },

  created() {
    this.getRightsList()
  },

  methods: {
    async getRightsList() {
      const data = await this.$axios.get('/rights/list')
      if (data.meta.status !== 200) return this.$message.error('获取权限列表失败!')
      this.rightsList = data.data
    }
  }
}
</script>

<style scoped lang='less'>
</style>
